<%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/tld/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Score List</title>
<link rel="stylesheet" type="text/css" href="css/FinalProjectCSS.css"/>
<script type="text/javascript" src="table.js"></script>
<script type="text/javascript">
	function flyToPage(task) {
		document.forms[0].task.value = task;
		document.forms[0].submit();
	}
</script>
</head>
<%
	if(session.getAttribute("result") != null)
	{
		String message = session.getAttribute("result").toString();
		%>
			<script type="text/javascript">
				window.alert('<%=message%>');
			</script>
		<%
		session.removeAttribute("result");
	}
%>
<body onkeydown="javascript:disableF5(event, 'listScore');">	
	<center>
		<table width="100%" class="bodyTable boxShadow">
		
			<!-- Header -->
			<tr>
				<td colspan="2"><%@include file="/include/Header.jsp"%></td>
			</tr>
		
			<!-- Content -->
			<tr>
				<td rowspan="2" width="200px" class="navigationBox"><%@include file="/include/Navigation.jsp"%></td>
				<td align="left" class="headerBox blueBackground">ACE Management > ACE-Score</td>
			</tr>
			<tr>
				<td align="center"  class="contentStyle"><br>
					<html:form action="/Score" method="post">
					<html:hidden property="task" name="scoreForm" />
 					<%if(!"trainee".equalsIgnoreCase(user.getRole())){ %>
					<table class="boxShadow" width="95%" border="0">
		    			<tr class="headerBox greyBackground">
		    				<td align="right" class="formListStyle">Batch</td>
		    				<td class="formListStyle">
		    				<%if(!"trainee".equalsIgnoreCase(user.getRole())){ %> 
		    					<html:select name="scoreForm" property="searchBatch" onchange="javascript:flyToPage('listScore');">
					    			<logic:notEmpty name="scoreForm" property="listBatch" >
					    				<html:optionsCollection name="scoreForm" property="listBatch" value="batchId" label="batchName" />
					    			</logic:notEmpty>
					    		</html:select>
					    	<%} %>
		    				</td>
		    				<td align="right" class="formListStyle">Subject</td>
		    				<td class="formListStyle">
		    				<%if(!"trainee".equalsIgnoreCase(user.getRole())){ %> 
		    					<html:select name="scoreForm" property="searchSubject" onchange="javascript:flyToPage('listScore');">
					    			<logic:notEmpty name="scoreForm" property="listSubject" >
					    				<html:option value="0">All</html:option>
					    				<html:optionsCollection name="scoreForm" property="listSubject" value="classId" label="className" />
					    			</logic:notEmpty>
					    			<logic:empty name="scoreForm" property="listSubject">
					    				<html:option value="0">No Subject</html:option>
					    			</logic:empty>
					    		</html:select>
					    	<%} %>
		    				</td>
		    				<td class="formListStyle" align="right">
<!-- 		    					<input type="button" title="get score report" class="buttonStyle" value="Generate Score Report" style="width: auto;cursor:pointer;" onclick="javascript:flyToPage('report');" /> -->
								<table title="generate score report" class="buttonStyle" style="cursor: pointer;" onclick="javascript:flyToPage('report');">
									<tr>
										<td style="vertical-align:middle;"><img src="images/reportButton.png"/></td>
										<td style="vertical-align:middle;"><b>&nbsp;Generate Score Report&nbsp;</b></td>
									</tr>
								</table>
		    				</td>
		    			</tr>
<!-- 		    			<tr align="center"> -->
<!-- 		    				<td colspan="6"><input type="button" value="Manage Score" onclick="javascript:flyToPage('insert');" /></td> -->
<!-- 		    			</tr> -->
    				</table>
    				<br />
    				<%}%>
					<table width="95%" border="0" align="center" class="boxShadow  example table-autosort table-autopage:10 table-stripeclass:alternate table-page-number:t1page table-page-count:t1pages table-filtered-rowcount:t1filtercount table-rowcount:t1allcount" id="t1">
						<thead>						
						<tr align="center" class="headerBox formHeaderBackground">
							<th colspan="2" align="center" class="formListStyle table-filterable table-sortable:default" style="vertical-align: middle; padding: 5px 7px; width: auto;">Name</th>
							<th align="center">Subject</th>
							<th align="center">Score</th>
							<th align="center" class="formListStyle table-filterable table-sortable:default">Grade</th>
						</tr>
						</thead>
						<tbody>
						<logic:notEmpty name="scoreForm" property="listScore">
							<logic:iterate id="listData" name="scoreForm" property="listScore">
								<tr class="formListBackground">
									<td colspan="2" width="40%" class="formListStyle"><bean:write name="listData" property="traineeName" /></td>
									<td align="center" class="formListStyle"><bean:write name="listData" property="className" /></td>
									<td align="center" class="formListStyle"><bean:write name="listData" property="score" /></td>
									<td align="center" class="formListStyle"><bean:write name="listData" property="grade" /></td>
								</tr>
							</logic:iterate>
						</logic:notEmpty>
						<logic:empty name="scoreForm" property="listScore">
							<tr align="center" class="formListBackground">
								<td colspan="5" class="formListStyle"><b>Data not found</b></td>		
							</tr>
						</logic:empty>
						</tbody>
						<tfoot>
							<tr class="headerBox formHeaderBackground">
								<td width="15%" class="table-page:previous formListStyle" style="cursor:pointer;">&lt;&lt; Previous</td>
								<td style="text-align:center; vertical-align: middle;" colspan="3">Page <span id="t1page"></span>&nbsp;of <span id="t1pages"></span></td>
								<td width="55px" align="right" class="table-page:next formListStyle" style="cursor:pointer;">Next &gt;&gt;</td>
							</tr>
<!-- 							<tr> -->
<!-- 								<td class="table-page:previous" style="cursor:pointer; padding:5px 7px;">&lt; &lt; Previous</td> -->
<!-- 								<td colspan="2" style="text-align:center; vertical-align: middle;">Page <span id="t1page"></span>&nbsp;of <span id="t1pages"></span></td> -->
<!-- 								<td align="right" class="table-page:next" style="cursor:pointer; vertical-align: middle; padding:5px 7px;">Next &gt; &gt;</td> -->
<!-- 							</tr> -->
							<tr>
								<td colspan="5" id="insertButton" title="manage score" align="center" class="greyBackground">						
									<div class="insertButtonGridStyle" onclick="javascript:flyToPage('insert');">
										<table>
											<tr>
												<td class="formListStyle"><img src="images/editButton.png"></td>
												<td class="formListStyle"><b>Manage Score</b></td>
											</tr>
										</table>
									</div>									
								</td>
							</tr>
							<tr class="headerBox formHeaderBackground">
								<td class="headerBox formHeaderBackground" colspan="5" align="center" style="padding:5px 7px;"><span id="t1filtercount">0</span>&nbsp;of <span id="t1allcount">0</span>&nbsp;rows match filter(s)</td>
							</tr>
						</tfoot>
					</table>
					</html:form><br>
				</td>
			</tr>
			
			<!-- Footer -->
			<tr>
				<td align="center" colspan="2" class="headerBox blueBackground">&copy; OME. 2013. All Rights Reserved.</td>
			</tr>
		</table>
	</center>
</body>
</html>